

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Afshin
 */
public class AISVW {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        GameController gc = new GameController();
        AgentDispatcher ad = new AgentDispatcher();
        gc.startGame(-84.386702, 33.77172, 10, 4);
        int killer = getKiller();
        int i = 0;
        while(!ad.isGameOver(Global.agents.get(killer))) {
            System.out.println("########################RUN " + i + "###############################");
            gc.getAgentLocs();
            wait(500);
            i++;
        }
    }

    public static void wait(int n) {
        long t0, t1;
        t0 = System.currentTimeMillis();
        do {
        t1 = System.currentTimeMillis();
        } while (t1 - t0 < n);
    }

    public static int getKiller() {
        int index = 0;
        for (int i = 0; i < Global.agents.size(); i++) {
            if (Global.agents.get(i).isKiller) {
                index = i;
            }
        }
        return index;
    }
}
